/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ULHT.LIG2N1.RC.SERVER;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrador
 */
public class UDPunicastListener implements Runnable {

    private DatagramSocket datagramSocket;

    public UDPunicastListener(DatagramSocket datagramSocket) {
        this.datagramSocket = datagramSocket;
    }

    @Override
    public void run() {
        byte[] buffer = new byte[256];

        DatagramPacket inPacket = new DatagramPacket(buffer, buffer.length);
        try {
            this.datagramSocket.receive(inPacket);
            InetAddress clientAddress = inPacket.getAddress();
            int clientPort = inPacket.getPort();
            String message = new String(inPacket.getData(),0,inPacket.getLength());
            if (message.equals("DESQUALIFICADO")){
                
            }
        } catch (IOException ex) {
            Logger.getLogger(UDPunicastListener.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
